stack: Don't underallocate the last_child
authorTimm Bäder <mail@baedert.org>
Fri, 26 Feb 2016 20:58:36 +0000 (21:58 +0100)
committerTimm Bäder <mail@baedert.org>
Thu, 12 May 2016 18:40:06 +0000 (20:40 +0200)
gtk/gtkstack.c

index fe1d16af1f0e9116d0be267594fce311e693f59d..882829c574fe9554a990031113a9cbad16e1e19a 100644 (file)
@@ -2237,19 +2237,24 @@ gtk_stack_allocate (GtkCssGadget        *gadget,
 
   child_allocation.x = 0;
   child_allocation.y = 0;
-  child_allocation.width = allocation->width;
-  child_allocation.height = allocation->height;
+
 
   if (priv->last_visible_child)
     {
       int min, nat;
-
+      gtk_widget_get_preferred_width (priv->last_visible_child->widget, &min, &nat);
+      child_allocation.width = MAX (min, allocation->width);
       gtk_widget_get_preferred_height_for_width (priv->last_visible_child->widget,
-                                                 allocation->width,
+                                                 child_allocation.width,
                                                  &min, &nat);
+      child_allocation.height = MAX (min, allocation->height);
+
       gtk_widget_size_allocate (priv->last_visible_child->widget, &child_allocation);
     }
 
+  child_allocation.width = allocation->width;
+  child_allocation.height = allocation->height;
+
   if (priv->visible_child)
     {
       int min, nat;